home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000873_reading@uintah.cs.utah.edu_Tue Aug 23 02:01:17 1994.msg < prev    next >
Internet Message Format  |  1994-10-11  |  3KB

  1. Received: from uintah.cs.utah.edu by cs.umb.edu with SMTP id AA04396
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Tue, 23 Aug 1994 10:01:20 -0400
  3. Received: by uintah.cs.utah.edu (5.65/DEC-Ultrix/4.3)
  4.     id AA24243; Tue, 23 Aug 1994 08:01:17 -0600
  5. Date: Tue, 23 Aug 1994 08:01:17 -0600
  6. From: reading@uintah.cs.utah.edu (Dan Reading)
  7. Message-Id: <9408231401.AA24243@uintah.cs.utah.edu>
  8. To: tex-k@cs.umb.edu
  9. Cc: reading@cs.utah.edu
  10. Subject: Test for SMART_PUTENV
  11.  
  12. Here is a forwarded message from Mike Hibler about the need to
  13. define SMART_PUTENV for our HPBSD 4.4 systems
  14. ------- Start of forwarded message -------
  15. From: mike@cs.utah.edu (Mike Hibler)
  16. To: reading@cs.utah.edu
  17. Cc: mike@cs.utah.edu
  18. Subject: one problem with xdvi
  19.  
  20. The kpathsea routines need to have SMART_PUTENV defined on the BSD boxes.
  21.  
  22. The install file says it should be defined for "net2" based systems but the
  23. configure script only looks for netbsd and freebsd.  You could just change
  24. that to check for anything that ends in "bsd" (to catch "4.3bsd" and
  25. "4.4BSD").  Something like:
  26.  
  27.     if `uname 2>/dev/null | grep -i -s 'bsd$'`; then ...
  28.  
  29. Unfortunately, "real" 4.3bsd doesn't even have "putenv" (much less "uname"),
  30. just our enhanced version does so that isn't really correct.
  31.  
  32. I whipped up a quick test program to distinguish (as they plead for in the
  33. INSTALL file).  If you were ambitious, you could work it in or just send it
  34. back to whoever.  It returned the correct result for machines I could get to:
  35.  
  36. hp300: Utah 4.3bsd, 4.4bsd
  37. hp700: Utah 4.3bsd, HP-UX 9.x, Acorn (OSF)
  38. i386: NetBSD 0.9
  39. r6000: AIX
  40. mips4400: IRIX
  41. sparc: SunOS, Solaris
  42. alpha: OSF
  43. mips: ULTRIX
  44.  
  45. ------- End of forwarded message -------
  46.  
  47. putenvtest.c:
  48. /*
  49.  * See if it is ok to free the old value of an environment string after
  50.  * we have changed its value with putenv.
  51.  * Credit to Mike Hibler mike@cs.utah.edu
  52.  */
  53. #include <stdlib.h>
  54.  
  55. #define VAR    "YOW_VAR"
  56. #define STRING1 "GabbaGabbaHey"
  57. #define STRING2 "Yow!!"        /* should be shorter than STRING1 */
  58.  
  59. main()
  60. {
  61.     char *str1, *rstr1, *str2, *rstr2;
  62.  
  63.     str1 = getenv(VAR);
  64.     if (str1)
  65.         exit(1);
  66.     str1 = malloc(strlen(VAR)+1+strlen(STRING1)+1);
  67.     if (str1 == 0)
  68.         exit(2);
  69.     strcpy(str1, VAR);
  70.     strcat(str1, "=");
  71.     strcat(str1, STRING1);
  72.     if (putenv(str1) < 0)
  73.         exit(3);
  74.     rstr1 = getenv(VAR);
  75.     if (rstr1 == 0)
  76.         exit(4);
  77.     rstr1 -= (strlen(VAR) + 1);
  78.     if (strncmp(rstr1, VAR, strlen(VAR)))
  79.         exit(5);
  80.     str2 = malloc(strlen(VAR)+1+strlen(STRING2)+1);
  81.     if (str2 == 0 || str1 == str2)
  82.         exit(6);
  83.     strcpy(str2, VAR);
  84.     strcat(str2, "=");
  85.     strcat(str2, STRING2);
  86.     if (putenv(str2) < 0)
  87.         exit(7);
  88.     rstr2 = getenv(VAR);
  89.     if (rstr2 == 0)
  90.         exit(8);
  91.     rstr2 -= (strlen(VAR) + 1);
  92. #if 0
  93.     printf("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2);
  94. #endif
  95.     /*
  96.      * If string from first call was reused for the second call,
  97.      * you had better not do a free on the first string!
  98.      */
  99.     if (rstr1 == rstr2)
  100.         printf("#define\tSMART_PUTENV\n");
  101.     else
  102.         printf("#undef\tSMART_PUTENV\n");
  103.     exit(0);
  104. }
  105.  
  106.